#!/bin/bash

clear

#echo ""
#echo "---------------------------------------------------"

#echo -e "|\33[44;30;4mScaneando Clientes na Rede, por favor
aguarde...!\33[m|"
echo "---------------------------------------------------"
echo "| CLIENTE Nome IP STATUS |"
echo "| |"
cfg="/etc/cbq/cbq.cfg"
#loop
for I in $(cat $cfg); do

#Ignorar comentarios
comentario=`echo $line | cut -c 1-1`
if [ $comentario != "#" ]then

#Extrair as Variaveis
nome= `cat /etc/cbq/cbq.cfg | awk '{print $1;}'`
ip= `cat /etc/cbq/cbq.cfg | awk '{print $2;}'`

ping -c 1 $I > /dev/null

ret=$?

if [ $ret = 0 ]; then
if [ $I = $ip ]; then
echo -e "| \33[0;33m $nome\33[m ---------------->$I
--->\33[42;30;5mOK!\33[m |"
fi
fi

if [ $ret = 1 ]; then
if [ $I = $ip ]; then
echo -e "| \33[0;33m $nome\33[m ---------------->$I
--->\33[41;30;5mDOWN!\33[m |"
fi
fi

fi
done
echo "| |"
#echo -e "
-------------------\33[44;30;4m||FIM||\33[m---------------------"
echo -e " --------------FIM------------------------------"
echo ""

---------------Arquivo "/etc/cbq/cbq.cfg ----------------

#Cliente Ip
#-------------- ---------------
Cliente1 192.168.0.57

